
cmake_minimum_required(VERSION 3.10)
project(myplugins)

# 启用 CUDA
enable_language(CUDA)

# 设置 CUDA 架构 (Jetson Nano 是 sm_72)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_72,code=sm_72")

# 查找 OpenCV
find_package(OpenCV REQUIRED)

# 添加源文件
file(GLOB SOURCES "src/*.cu" "src/*.cpp")

# 创建共享库
add_library(myplugins SHARED ${SOURCES})

# 包含目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${OpenCV_INCLUDE_DIRS}
)

# 链接库
target_link_libraries(myplugins
    ${OpenCV_LIBS}
    nvinfer
    nvinfer_plugin
    cudart
)
